<style>
  .ivu-card-head {
    border-bottom: 1px solid #e8eaec;
    padding: 14px 16px;
    padding-top: 12px;
    padding-right: 16px;
    padding-bottom: 0px;
    padding-left: 1px;
    line-height: 1;
  }

  .ivu-card-body {
    padding: 0px;
    padding-top: 0px;
    padding-right: 0px;
    padding-bottom: 0px;
    padding-left: 0px;
  }

  .ivu-card-head-my {
    padding: 14px;
    padding-top: 15px;
    padding-right: 15px;
    padding-bottom: 15px;
    padding-left: 15px;
  }

  .expand-row {
    margin-bottom: 16px;
    left: 5%;
  }

  .ivu-checkbox-wrapper {
    font-size: 0px;
  }
</style>
<template>
  <div v-if="serviceType != 'accountCancel'">
    <Row>
      <Col span="24">
      <Card dis-hover>
        <div slot="title">
          <Menu mode="horizontal" :active-name="menuName" @on-select="changeMenu">
            <MenuItem name="severs" v-if="(severs.length>0)">
            <span v-if="page==='accountManager'">主机</span>
            <Badge v-else :count="todo_ser" :offset="[15,-5]">
              主机
            </Badge>
            </MenuItem>
            <MenuItem name="dbs" v-if="(dbs.length>0)">
            <span v-if="page==='accountManager'">数据库</span>
            <Badge v-else :count="todo_db" :offset="[15,-5]">
              数据库
            </Badge>
            </MenuItem>
            <MenuItem name="hadoop" v-if="(hadoops.length>0)">
            <span v-if="page==='accountManager'">Hadoop</span>
            <Badge v-else :count="todo_hadoop" :offset="[15,-5]">
              Hadoop
            </Badge>
            </MenuItem>
            <MenuItem name="uap" v-if="(hftps.length>0)">
            <span v-if="page==='accountManager'">UAP</span>
            <Badge v-else :count="todo_uap" :offset="[15,-5]">
              UAP
            </Badge>
            </MenuItem>
            <MenuItem name="paas" v-if="(paas.length>0)">
            <span v-if="page==='accountManager'">PaaS</span>
            <Badge v-else :count="todo_paas" :offset="[15,-5]">
              PaaS
            </Badge>
            </MenuItem>
            <MenuItem name="dacp" v-if="(dacps.length>0)">
            <span v-if="page==='accountManager'">DACP</span>
            <Badge v-else :count="todo_dacp" :offset="[15,-5]">
              DACP
            </Badge>
            </MenuItem>
            <MenuItem name="elseAuth" v-if="(elseAuthes.length>0)">
            <span v-if="page==='accountManager'">其他</span>
            <Badge v-else :count="todo_else" :offset="[15,-5]">
              其他
            </Badge>
            </MenuItem>
          </Menu>
        </div>
        <div>
          <Table border :columns="ser_columns" :data="severs" v-if="isSevers" style="width: 100%;">
            <template slot-scope="{row, index}" slot="action">
              <CheckboxGroup v-model="sonRecord.severs" @on-change="selectSevers()">
                <Checkbox :label="row.id" :disabled="(!row.ifSelect)">
                  <span></span>
                </Checkbox>
              </CheckboxGroup>
            </template>
            <template slot-scope="{row, index}" slot="toSonAccount">
              <div style="padding-top:5%" v-if="!isCancel">
                <Button type="primary" size="small" @click="peopleMessage(row,index)">人员信息</Button>
              </div>
              <div style="padding:5% 0 5% 0">
                <Button type="primary" size="small" :disabled="row.alloReqId==0"
                  @click="toSonAccount(row,index)">查看子流程</Button>
              </div>
            </template>
            <template slot-scope="{row, index}" slot="ifHandle">
              <span v-if="row.ifHandle">是</span>
              <span v-else>否</span>
            </template>
          </Table>
          <Table border :columns="dbs_columns" :data="dbs" v-if="isDBs">
            <template slot-scope="{row, index}" slot="action">
              <CheckboxGroup v-model="sonRecord.dbs" @on-change="selectDBs()">
                <Checkbox :label="row.id" :disabled="(!row.ifSelect)">
                  <span></span>
                </Checkbox>
              </CheckboxGroup>
            </template>
            <template slot-scope="{row, index}" slot="toSonAccount">
              <div style="padding-top:5%" v-if="!isCancel">
                <Button type="primary" size="small" @click="peopleMessage(row,index)">人员信息</Button>
              </div>
              <div style="padding:5% 0 5% 0">
                <Button type="primary" size="small" :disabled="row.alloReqId==0"
                  @click="toSonAccount(row,index)">查看子流程</Button>
              </div>
            </template>
            <template slot-scope="{row, index}" slot="ifHandle">
              <span v-if="row.ifHandle">是</span>
              <span v-else>否</span>
            </template>
          </Table>
          <Table border :columns="hadoop_columns" :data="hadoops" v-if="isHadoop">
            <template slot-scope="{row, index}" slot="action">
              <CheckboxGroup v-model="sonRecord.hadoops" @on-change="selectHadoops()">
                <Checkbox :label="row.id" :disabled="(!row.ifSelect)">
                  <span></span>
                </Checkbox>
              </CheckboxGroup>
            </template>
            <template slot-scope="{row, index}" slot="toSonAccount">
              <div style="padding-top:5%" v-if="!isCancel">
                <Button type="primary" size="small" @click="peopleMessage(row,index)">人员信息</Button>
              </div>
              <div style="padding:5% 0 5% 0">
                <Button type="primary" size="small" :disabled="row.alloReqId==0"
                  @click="toSonAccount(row,index)">查看子流程</Button>
              </div>
            </template>
            <template slot-scope="{row, index}" slot="ifHandle">
              <span v-if="row.ifHandle">是</span>
              <span v-else>否</span>
            </template>
          </Table>
          <Table border :columns="uap_columns" :data="hftps" v-if="isHftp">
            <template slot-scope="{row, index}" slot="action">
              <CheckboxGroup v-model="sonRecord.hftps" @on-change="selectHftps()">
                <Checkbox :label="row.id" :disabled="(!row.ifSelect)">
                  <span></span>
                </Checkbox>
              </CheckboxGroup>
            </template>
            <template slot-scope="{row, index}" slot="toSonAccount">
              <div style="padding-top:5%" v-if="!isCancel">
                <Button type="primary" size="small" @click="peopleMessage(row,index)">人员信息</Button>
              </div>
              <div style="padding:5% 0 5% 0">
                <Button type="primary" size="small" :disabled="row.alloReqId==0"
                  @click="toSonAccount(row,index)">查看子流程</Button>
              </div>
            </template>
            <template slot-scope="{row, index}" slot="des">
              <p v-if="row.isCluster">采集交换集群与租户集群数据流转</p>
              <p v-if="row.isPerson">采集交换集群与租户个人FTP数据流转</p>
              <p v-if="row.isPro">采集交换集群与生产集群（如Hadoop三期二生产集群）数据流转</p>
            </template>
            <template slot-scope="{row, index}" slot="ifHandle">
              <span v-if="row.ifHandle">是</span>
              <span v-else>否</span>
            </template>
          </Table>
          <Table border :columns="paas_columns" :data="paas" v-if="isPaaS">
            <template slot-scope="{row, index}" slot="action">
              <CheckboxGroup v-model="sonRecord.paas" @on-change="selectPaas()">
                <Checkbox :label="row.id" :disabled="(!row.ifSelect)">
                  <span></span>
                </Checkbox>
              </CheckboxGroup>
            </template>
            <template slot-scope="{row, index}" slot="toSonAccount">
              <div style="padding-top:5%" v-if="!isCancel">
                <Button type="primary" size="small" @click="peopleMessage(row,index)">人员信息</Button>
              </div>
              <div style="padding:5% 0 5% 0">
                <Button type="primary" size="small" :disabled="row.alloReqId==0"
                  @click="toSonAccount(row,index)">查看子流程</Button>
              </div>
            </template>
            <template slot-scope="{row, index}" slot="paasType">
              <span v-if="row.paasType=='paas_huawei'">华为PaaS</span>
              <span v-if="row.paasType=='paas_asia'">亚信PaaS</span>
            </template>
            <template slot-scope="{row, index}" slot="ifHandle">
              <span v-if="row.ifHandle">是</span>
              <span v-else>否</span>
            </template>
          </Table>
          <Table border :columns="dacp_columns" :data="dacps" v-if="isDACP">
            <template slot-scope="{row, index}" slot="action">
              <CheckboxGroup v-model="sonRecord.dacps" @on-change="selectDacps()">
                <Checkbox :label="row.id" :disabled="(!row.ifSelect)">
                  <span></span>
                </Checkbox>
              </CheckboxGroup>
            </template>
            <template slot-scope="{row, index}" slot="toSonAccount">
              <div style="padding-top:5%" v-if="!isCancel">
                <Button type="primary" size="small" @click="peopleMessage(row,index)">人员信息</Button>
              </div>
              <div style="padding:5% 0 5% 0">
                <Button type="primary" size="small" :disabled="row.alloReqId==0"
                  @click="toSonAccount(row,index)">查看子流程</Button>
              </div>
            </template>
            <template slot-scope="{row, index}" slot="ifHandle">
              <span v-if="row.ifHandle">是</span>
              <span v-else>否</span>
            </template>
          </Table>
          <Table border :columns="else_columns" :data="elseAuthes" v-if="isElseAuth">
            <template slot-scope="{row, index}" slot="action">
              <CheckboxGroup v-model="sonRecord.elseAuthes" @on-change="selectElseAuthes()">
                <Checkbox :label="row.id" :disabled="(!row.ifSelect)">
                  <span></span>
                </Checkbox>
              </CheckboxGroup>
            </template>
            <template slot-scope="{row, index}" slot="toSonAccount">
              <div style="padding-top:5%" v-if="!isCancel">
                <Button type="primary" size="small" @click="peopleMessage(row,index)">人员信息</Button>
              </div>
              <div style="padding:5% 0 5% 0">
                <Button type="primary" size="small" :disabled="row.alloReqId==0"
                  @click="toSonAccount(row,index)">查看子工单</Button>
              </div>
            </template>
            <template slot-scope="{row, index}" slot="ifHandle">
              <span v-if="row.ifHandle">是</span>
              <span v-else>否</span>
            </template>
          </Table>
        </div>
      </Card>
      </Col>
    </Row>

    <Modal v-model="peopleModal" width="600" :footer-hide="true">
      <p slot="header" style="text-align:center">
        <span>人员信息</span>
      </p>
      <div>
        <Row class="expand-row">
          <Col span="8" >
          <b>姓名：</b>
          <span>{{peopleShow.peopleName}}</span>
          </Col>
          <Col span="10" style="left:15%">
          <b>4A主账号：</b>
          <span>{{peopleShow.fourA}}</span>
          </Col>
        </Row>
        <Row class="expand-row">
          <Col span="8" >
          <b>联系方式：</b>
          <span>{{peopleShow.phone}}</span>
          </Col>
          <Col span="10" style="left:15%">
          <b>组织名称：</b>
          <span>{{peopleShow.outterCompany}}</span>
          </Col>
        </Row>
        <Row class="expand-row">
          <Col span="8" >
          <b>工作职责：</b>
          <span>{{peopleShow.duty}}</span>
          </Col>
          <Col span="10" style="left:15%">
          <b>已有账号名：</b>
          <span>{{peopleShow.exAccount}}</span>
          </Col>
        </Row>
      </div>
      <div slot="footer">
      </div>
    </Modal>
  </div>
</template>
<script>
  import ajax from "../../../ajax_util"
  import Axios from 'axios'
  import expandRow from '../../sonAccount_expand'
  import untils from "../../../utils/excel"

  export default {
    components: {
      expandRow,
      untils
    },
    data() {
      return {
        peopleIdList: [],
        severs: [],
        dbs: [],
        hadoops: [],
        hftps: [],
        paas: [],
        dacps: [],
        elseAuthes: [],
        isSevers: false,
        isDBs: false,
        isHadoop: false,
        isHftp: false,
        isPaaS: false,
        isDACP: false,
        isElseAuth: false,
        menuName: "",



        tabs: {},
        peopleModal: false,
        peopleMap: {},
        peopleShow: {},
        reqid: 0,
        files: [],
        people: [],
        account: {},
        sonRecord: {
          dacps: [],
          dbs: [],
          elseAuthes: [],
          files: [{
            fileName: "",
            fileUrl: ""
          }],
          hadoops: [],
          hftps: [],
          paas: [],
          reqId: 0,
          severs: []
        },
        content: {
          reqSubject: "",
          reqDes: ""
        },

        showFileMould: false,
        showmd: true,

        haveSevers: false,
        checkAllSevers: false,
        allServerList: [],

        haveDBs: false,
        checkAllDBs: false,
        allDbsList: [],

        haveHadoops: false,
        checkAllHadoops: false,
        allHadoopList: [],

        haveUaps: false,
        checkAllUaps: false,
        allUapList: [],

        havePaas: false,
        checkAllPaas: false,
        allPaasList: [],

        haveDacps: false,
        checkAllDacps: false,
        allDacpList: [],

        haveElse: false,
        checkAllElse: false,
        allElseList: [],



        todo_ser: 0,
        todo_db: 0,
        todo_hadoop: 0,
        todo_uap: 0,
        todo_paas: 0,
        todo_dacp: 0,
        todo_else: 0,
        options: {
          disabledDate(date) {
            return date && date.valueOf() < Date.now() - 86400000;
          }
        },
        cancelList: [{
            value: 0,
            label: '不可删除'
          },
          {
            value: 1,
            label: '可删除'
          },
        ],
        sonAccount: {},
        isNoToChildren: false,
        isCancel: false,
        ifHandle: false,
        //ifNoCancelSon:true
      }
    },
    created: function() {
      this.tabs = this.$store.state.tabs;
      console.log("!!!43434!!", this.isEdit);

      if (this.serviceType === 'sonAccountAllo' && this.isEdit == 10) {
        this.loadingSpinNumber++
        this.getNoHandleAccountt(this.myAccount.content);
        //this.getAccountSon(this.myAccount.reqId);
      }

      if ((this.serviceType === 'accountNoBigdata' || this.serviceType === 'accountBigdata') && this.isEdit == 10) {
        console.log("-----datadata-----", this.myAccount.content);
        this.loadingSpinNumber++;
        this.ifHandle = true;
        this.getAccountSon(this.myAccount.content.reqId);
      }

      // if( (this.serviceType === 'accountNoBigdata' && this.taskDefKey === '_08son') || (this.serviceType === 'accountBigdata' && this.taskDefKey === '_08son') ){
      //     this.ifHandle = true;
      // }

      if (this.serviceType === 'accountCancel' && this.isEdit == 14) {
        console.log("====accountCancel=====", this.myAccount.content);
        this.isCancel = true;
        this.getAccountCancel(this.myAccount.content.reqId);
      }
    },
    methods: {
      exportAccountCancel() {
        console.log("=2222=exportAccountCancel==");

        //列标题，逗号隔开
        let str = `姓名,主账号,从账号,账号类型,账号属性,ip信息,组读和执行权限目录,组需写权限目录\n`;
        //增加\t为了不让表格显示科学计数法或者其他格式
        for (let j = 0; j < this.severs.length; j++) {
          //str+=`${jsonData[i][item] + '\t'},`;
          str += this.severs[j].peopleName + "," + this.severs[j].fourA + "," + this.severs[j].subAccount + "," +
            "主机账号" + "," + this.severs[j].accountAttr + "," + this.severs[j].ip + "," +
            this.severs[j].rxPath + "," + this.severs[j].wpath + '\n';
        }

        for (let j = 0; j < this.dbs.length; j++) {
          //str+=`${jsonData[i][item] + '\t'},`;
          str += this.dbs[j].peopleName + "," + this.dbs[j].fourA + "," + this.dbs[j].subAccount + "," + "数据库账号" + "," +
            this.dbs[j].accountAttr + "," + this.dbs[j].ip +
            "," + "" + "," + "" + '\n';
        }

        for (let j = 0; j < this.hadoops.length; j++) {
          //str+=`${jsonData[i][item] + '\t'},`;
          str += this.hadoops[j].peopleName + "," + this.hadoops[j].fourA + "," + this.hadoops[j].subAccount + "," +
            "Hadoop账号" + "," + "" + "," + "" + "," + "" + "," + "" + '\n';
        }

        for (let j = 0; j < this.hftps.length; j++) {
          //str+=`${jsonData[i][item] + '\t'},`;
          str += this.hftps[j].peopleName + "," + this.hftps[j].fourA + "," + this.hftps[j].subAccount + "," +
            "UAP账号" + "," + "" + "," + "" + "," + "" + "," + "" + '\n';
        }

        for (let j = 0; j < this.paas.length; j++) {
          //str+=`${jsonData[i][item] + '\t'},`;
          str += this.paas[j].peopleName + "," + this.paas[j].fourA + "," + this.paas[j].subAccount + "," +
            "PaaS账号" + "," + "" + "," + "" + "," + "" + "," + "" + '\n';
        }

        for (let j = 0; j < this.dacps.length; j++) {
          //str+=`${jsonData[i][item] + '\t'},`;
          str += this.dacps[j].peopleName + "," + this.dacps[j].fourA + "," + this.dacps[j].subAccount + "," +
            "DACP账号" + "," + "" + "," + "" + "," + "" + "," + "" + '\n';
        }

        for (let j = 0; j < this.elseAuthes.length; j++) {
          //str+=`${jsonData[i][item] + '\t'},`;
          str += this.elseAuthes[j].peopleName + "," + this.elseAuthes[j].fourA + "," + this.elseAuthes[j].subAccount +
            "," +
            "其他账号" + "," + "" + "," + "" + "," + "" + "," + "" + '\n';
        }

        //encodeURIComponent解决中文乱码， \ufeff是 ""
        let uri = 'data:text/csv;charset=utf-8,\ufeff' + encodeURIComponent(str);
        //通过创建a标签实现
        let link = document.createElement("a");
        link.href = uri;
        //对下载的文件命名
        var timestamp = new Date().getTime();
        link.download = "销户信息账号_" + timestamp + ".csv";
        document.body.appendChild(link);
        link.click();
        document.body.removeChild(link);
      },
      getMenuName() {
        if (this.severs.length > 0) {
          this.menuName = "severs";
          this.isSevers = true;
        } else if (this.dbs.length > 0) {
          this.menuName = "dbs";
          this.isDBs = true;
        } else if (this.hadoops.length > 0) {
          this.menuName = "hadoop";
          this.isHadoop = true;
        } else if (this.hftps.length > 0) {
          this.menuName = "uap";
          this.isHftp = true;
        } else if (this.paas.length > 0) {
          this.menuName = "paas";
          this.isPaaS = true;
        } else if (this.dacps.length > 0) {
          this.menuName = "dacp";
          this.isDACP = true;
        } else if (this.elseAuthes.length > 0) {
          this.menuName = "elseAuth";
          this.isElseAuth = true;
        }
      },
      changeMenu(name) {
        if (name == "severs") {
          this.isSevers = true;
          this.isDBs = false;
          this.isHadoop = false;
          this.isHftp = false;
          this.isPaaS = false;
          this.isDACP = false;
          this.isElseAuth = false;
        } else if (name == "dbs") {
          this.isSevers = false;
          this.isDBs = true;
          this.isHadoop = false;
          this.isHftp = false;
          this.isPaaS = false;
          this.isDACP = false;
          this.isElseAuth = false;
        } else if (name == "hadoop") {
          this.isSevers = false;
          this.isDBs = false;
          this.isHadoop = true;
          this.isHftp = false;
          this.isPaaS = false;
          this.isDACP = false;
          this.isElseAuth = false;
        } else if (name == "uap") {
          this.isSevers = false;
          this.isDBs = false;
          this.isHadoop = false;
          this.isHftp = true;
          this.isPaaS = false;
          this.isDACP = false;
          this.isElseAuth = false;
        } else if (name == "paas") {
          this.isSevers = false;
          this.isDBs = false;
          this.isHadoop = false;
          this.isHftp = false;
          this.isPaaS = true;
          this.isDACP = false;
          this.isElseAuth = false;
        } else if (name == "dacp") {
          this.isSevers = false;
          this.isDBs = false;
          this.isHadoop = false;
          this.isHftp = false;
          this.isPaaS = false;
          this.isDACP = true;
          this.isElseAuth = false;
        } else if (name == "elseAuth") {
          this.isSevers = false;
          this.isDBs = false;
          this.isHadoop = false;
          this.isHftp = false;
          this.isPaaS = false;
          this.isDACP = false;
          this.isElseAuth = true;
        }
      },


      getNoHandleAccountt(people) {
        console.log("66666666", people);
        if (people.severs != undefined && people.severs != null) {
          for (var i = 0; i < people.severs.length; i++) {
            people.severs[i].date = this.utils.formatDate(new Date(people.severs[i].deadline * 1000), "yyyy-MM-dd");
            if (this.isCancel) {
              if (people.severs[i].alloReqId == 0) {
                //console.log("#######");
                people.severs[i].ifSelect = true;
                this.allServerList.push(people.severs[i].id);
              } else {
                people.severs[i].ifSelect = false;
              }
            } else {
              if (people.severs[i].alloReqId == 0 && people.severs[i].status > 0) {
                people.severs[i].ifSelect = true;
                console.log("888888888");
                people.severs[i].ifHandle = false;
                this.allServerList.push(people.severs[i].id);
              } else {
                people.severs[i].ifSelect = false;
                console.log("777777");
                people.severs[i].ifHandle = true;
              }
            }

          }

          this.todo_ser = this.allServerList.length;
          this.severs = people.severs;
          console.log("#######", this.severs);
        }

        if (people.dbs != undefined && people.dbs != null) {
          for (var i = 0; i < people.dbs.length; i++) {
            people.dbs[i].date = this.utils.formatDate(new Date(people.dbs[i].deadline * 1000), "yyyy-MM-dd");
            if (this.isCancel) {
              if (people.dbs[i].alloReqId == 0) {
                people.dbs[i].ifSelect = true;
                this.allDbsList.push(people.dbs[i].id);
              } else {
                people.dbs[i].ifSelect = false;
              }
            } else {
              if (people.dbs[i].alloReqId == 0 && people.dbs[i].status > 0) {
                people.dbs[i].ifSelect = true;
                people.dbs[i].ifHandle = false;
                this.allDbsList.push(people.dbs[i].id);
              } else {
                people.dbs[i].ifSelect = false;
                people.dbs[i].ifHandle = true;
              }
            }
          }
          this.todo_db = this.allDbsList.length;
          this.dbs = people.dbs;
        }

        if (people.hadoops != undefined && people.hadoops != null) {
          for (var i = 0; i < people.hadoops.length; i++) {
            people.hadoops[i].date = this.utils.formatDate(new Date(people.hadoops[i].deadline * 1000), "yyyy-MM-dd");
            if (this.isCancel) {
              if (people.hadoops[i].alloReqId == 0) {
                people.hadoops[i].ifSelect = true;
                this.allHadoopList.push(people.hadoops[i].id);
              } else {
                people.hadoops[i].ifSelect = false;
              }
            } else {
              if (people.hadoops[i].alloReqId == 0 && people.hadoops[i].status > 0) {
                people.hadoops[i].ifSelect = true;
                people.hadoops[i].ifHandle = false;
                this.allHadoopList.push(people.hadoops[i].id);
              } else {
                people.hadoops[i].ifSelect = false;
                people.hadoops[i].ifHandle = true;
              }
            }
          }
          this.todo_hadoop = this.allHadoopList.length;
          this.hadoops = people.hadoops;
          //console.log("====this.allHadoopList====",this.todo_hadoop);
        }

        if (people.hftps != undefined && people.hftps != null) {
          for (var i = 0; i < people.hftps.length; i++) {
            people.hftps[i].date = this.utils.formatDate(new Date(people.hftps[i].deadline * 1000), "yyyy-MM-dd");
            if (this.isCancel) {
              if (people.hftps[i].alloReqId == 0) {
                people.hftps[i].ifSelect = true;
                this.allUapList.push(people.hftps[i].id);
              } else {
                people.hftps[i].ifSelect = false;
              }
            } else {
              if (people.hftps[i].alloReqId == 0 && people.hftps[i].status > 0) {
                people.hftps[i].ifSelect = true;
                people.hftps[i].ifHandle = false;
                this.allUapList.push(people.hftps[i].id);
              } else {
                people.hftps[i].ifSelect = false;
                people.hftps[i].ifHandle = true;
              }
            }
          }
          this.todo_uap = this.allUapList.length;
          this.hftps = people.hftps;
        }

        if (people.paas != undefined && people.paas != null) {
          for (var i = 0; i < people.paas.length; i++) {
            people.paas[i].date = this.utils.formatDate(new Date(people.paas[i].deadline * 1000), "yyyy-MM-dd");
            if (this.isCancel) {
              if (people.paas[i].alloReqId == 0) {
                people.paas[i].ifSelect = true;
                this.allPaasList.push(people.paas[i].id);
              } else {
                people.paas[i].ifSelect = false;
              }
            } else {
              if (people.paas[i].alloReqId == 0 && people.paas[i].status > 0) {
                people.paas[i].ifSelect = true;
                people.paas[i].ifHandle = false;
                this.allPaasList.push(people.paas[i].id);
              } else {
                people.paas[i].ifSelect = false;
                people.paas[i].ifHandle = true;
              }
            }

          }
          this.todo_paas = this.allPaasList.length;
          this.paas = people.paas;
        }

        if (people.dacps != undefined && people.dacps != null) {
          for (var i = 0; i < people.dacps.length; i++) {
            people.dacps[i].date = this.utils.formatDate(new Date(people.dacps[i].deadline * 1000), "yyyy-MM-dd");
            if (this.isCancel) {
              if (people.dacps[i].alloReqId == 0) {
                people.dacps[i].ifSelect = true;
                this.allDacpList.push(people.dacps[i].id);
              } else {
                people.dacps[i].ifSelect = false;
              }
            } else {
              if (people.dacps[i].alloReqId == 0 && people.dacps[i].status > 0) {
                people.dacps[i].ifSelect = true;
                people.dacps[i].ifHandle = false;
                this.allDacpList.push(people.dacps[i].id);
              } else {
                people.dacps[i].ifSelect = false;
                people.dacps[i].ifHandle = true;
              }
            }
          }
          this.todo_dacp = this.allDacpList.length;
          this.dacps = people.dacps;
        }

        if (people.elseAuthes != undefined && people.elseAuthes != null) {
          for (var i = 0; i < people.elseAuthes.length; i++) {
            people.elseAuthes[i].date = this.utils.formatDate(new Date(people.elseAuthes[i].deadline * 1000),
              "yyyy-MM-dd");
            if (this.isCancel) {
              if (people.elseAuthes[i].alloReqId == 0) {
                people.elseAuthes[i].ifSelect = true;
                this.allElseList.push(people.elseAuthes[i].id);
              } else {
                people.elseAuthes[i].ifSelect = false;
              }
            } else {
              if (people.elseAuthes[i].alloReqId == 0 && people.elseAuthes[i].status > 0) {
                people.elseAuthes[i].ifSelect = true;
                people.elseAuthes[i].ifHandle = false;
                this.allElseList.push(people.elseAuthes[i].id);
              } else {
                people.elseAuthes[i].ifSelect = false;
                people.elseAuthes[i].ifHandle = true;
              }
            }
          }
          this.todo_else = this.allElseList.length;
          this.elseAuthes = people.elseAuthes;
        }

        if (people.files != undefined && people.files != null) {
          this.files = people.files;
        }

        if (this.allServerList.length == 0 && this.allDbsList.length == 0 && this.allHadoopList.length == 0 && this
          .allUapList.length == 0 && this.allPaasList.length == 0 && this.allDacpList.length == 0 && this.allElseList
          .length == 0) {
          this.isNoToChildren = true;
        }
        console.log("----isNoToChildren-----", this.isNoToChildren);
        this.getMenuName();
      },
      selectAllSevers() {
        if (this.haveSevers) {
          this.checkAllSevers = false;
        } else {
          this.checkAllSevers = !this.checkAllSevers;
        }
        this.haveSevers = false;

        if (this.checkAllSevers) {
          this.sonRecord.severs = this.allServerList;
        } else {
          this.sonRecord.severs = [];
        }
        //console.log("-----1111----",this.checkAllSevers,this.haveSevers);
      },
      selectSevers() {
        //console.log("---------severs----------",this.sonRecord.severs);
        if (this.sonRecord.severs.length === this.allServerList.length) {
          this.haveSevers = false;
          this.checkAllSevers = true;
        } else if (this.sonRecord.severs.length > 0) {
          this.haveSevers = true;
          this.checkAllSevers = false;
        } else {
          this.haveSevers = false;
          this.checkAllSevers = false;
        }
      },
      selectAllDBs() {
        if (this.haveDBs) {
          this.checkAllDBs = false;
        } else {
          this.checkAllDBs = !this.checkAllDBs;
        }
        this.haveDBs = false;

        if (this.checkAllDBs) {
          this.sonRecord.dbs = this.allDbsList;
        } else {
          this.sonRecord.dbs = [];
        }
      },
      selectDBs() {
        //console.log("---------dbs----------",this.sonRecord.dbs);
        if (this.sonRecord.dbs.length === this.allDbsList.length) {
          this.haveDBs = false;
          this.checkAllDBs = true;
        } else if (this.sonRecord.dbs.length > 0) {
          this.haveDBs = true;
          this.checkAllDBs = false;
        } else {
          this.haveDBs = false;
          this.checkAllDBs = false;
        }
      },
      selectAllHadoops() {
        if (this.haveHadoops) {
          this.checkAllHadoops = false;
        } else {
          this.checkAllHadoops = !this.checkAllHadoops;
        }
        this.haveHadoops = false;

        if (this.checkAllHadoops) {
          this.sonRecord.hadoops = this.allHadoopList;
        } else {
          this.sonRecord.hadoops = [];
        }
      },
      selectHadoops() {
        //console.log("---------hadoops----------",this.sonRecord.hadoops);
        if (this.sonRecord.hadoops.length === this.allHadoopList.length) {
          this.haveHadoops = false;
          this.checkAllHadoops = true;
        } else if (this.sonRecord.hadoops.length > 0) {
          this.haveHadoops = true;
          this.checkAllHadoops = false;
        } else {
          this.haveHadoops = false;
          this.checkAllHadoops = false;
        }
      },
      selectAllUaps() {
        if (this.haveUaps) {
          this.checkAllUaps = false;
        } else {
          this.checkAllUaps = !this.checkAllUaps;
        }
        this.haveUaps = false;

        if (this.checkAllUaps) {
          this.sonRecord.hftps = this.allUapList;
        } else {
          this.sonRecord.hftps = [];
        }
      },
      selectHftps() {
        //console.log("---------hftps----------",this.sonRecord.hftps);
        if (this.sonRecord.hftps.length === this.allUapList.length) {
          this.haveUaps = false;
          this.checkAllUaps = true;
        } else if (this.sonRecord.hftps.length > 0) {
          this.haveUaps = true;
          this.checkAllUaps = false;
        } else {
          this.haveUaps = false;
          this.checkAllUaps = false;
        }
      },
      selectAllPaas() {
        if (this.havePaas) {
          this.checkAllPaas = false;
        } else {
          this.checkAllPaas = !this.checkAllPaas;
        }
        this.havePaas = false;

        if (this.checkAllPaas) {
          this.sonRecord.paas = this.allPaasList;
        } else {
          this.sonRecord.paas = [];
        }
      },
      selectPaas() {
        //console.log("---------paas----------",this.sonRecord.paas);
        if (this.sonRecord.paas.length === this.allPaasList.length) {
          this.havePaas = false;
          this.checkAllPaas = true;
        } else if (this.sonRecord.paas.length > 0) {
          this.havePaas = true;
          this.checkAllPaas = false;
        } else {
          this.havePaas = false;
          this.checkAllPaas = false;
        }
      },
      selectAllDacps() {
        if (this.haveDacps) {
          this.checkAllDacps = false;
        } else {
          this.checkAllDacps = !this.checkAllDacps;
        }
        this.haveDacps = false;

        if (this.checkAllDacps) {
          this.sonRecord.dacps = this.allDacpList;
        } else {
          this.sonRecord.dacps = [];
        }
      },
      selectDacps() {
        //console.log("---------dacps----------",this.sonRecord.dacps);
        if (this.sonRecord.dacps.length === this.allDacpList.length) {
          this.haveDacps = false;
          this.checkAllDacps = true;
        } else if (this.sonRecord.dacps.length > 0) {
          this.haveDacps = true;
          this.checkAllDacps = false;
        } else {
          this.haveDacps = false;
          this.checkAllDacps = false;
        }
      },
      selectAllElse() {
        if (this.haveElse) {
          this.checkAllElse = false;
        } else {
          this.checkAllElse = !this.checkAllElse;
        }
        this.haveElse = false;

        if (this.checkAllElse) {
          this.sonRecord.elseAuthes = this.allElseList;
        } else {
          this.sonRecord.elseAuthes = [];
        }
      },
      selectElseAuthes() {
        //console.log("---------elseAuthes----------",this.sonRecord.elseAuthes);
        if (this.sonRecord.elseAuthes.length === this.allElseList.length) {
          this.haveElse = false;
          this.checkAllElse = true;
        } else if (this.sonRecord.elseAuthes.length > 0) {
          this.haveElse = true;
          this.checkAllElse = false;
        } else {
          this.haveElse = false;
          this.checkAllElse = false;
        }
      },
      peopleMessage(row, index) {
        this.peopleShow = this.peopleMap[row.peopleId];
        //console.log("this.peopleShow---->",this.peopleShow)
        this.peopleModal = true;
      },
      toSonAccount(row, index) {
        console.log("row---->", row)
        var isName = false
        this.tabs.list.some(item => {
          if (item.tabKey === row.alloReqId + '') {
            isName = true
            return
          }
        })
        if (!isName) {
          this.tabs.list.push({
            title: "子流程详情",
            key: "handle",
            tabKey: row.alloReqId + '',
            params: {
              reqId: row.alloReqId,
              state: row.status,
              taskDefKey: row.task_def_key
            }
          })
        }
        this.tabs.tabsPage = row.alloReqId + ''
        this.$store.commit("tabs", this.tabs);
      },


      getAccountCancel(reqId) {
        //console.log("9999999");
        //this.taskDefKey = this.params.taskDefKey;
        this.isCancel = true;
        var url = this.CONFIG.progress_url + "/account-withdraw/condition/" + reqId;
        var that = this;
        ajax.get({
          url: url,
          that: that,
          params: null,
          success: function(data) {
            console.log("-----getAccountCancel---", data);
            that.sonAccount = data;
            that.getNoHandleAccountt(data);
          }
        })
      },

      getAccountSon(reqId) {
        var url = this.CONFIG.progress_url + "/account-allo-condition/" + reqId
        var that = this;
        ajax.get({
          url: url,
          that: that,
          params: null,
          success: function(data) {
            console.log("-----this.data------------->", data, reqId);
            that.sonAccount = data;
            that.getNoHandleAccountt(data);
          }
        })
      }
    },
    computed: {
      ser_columns() {
        let ser_columns = [];

        if (!this.ifedit && this.page != 'accountManager') {
          ser_columns.push({
            title: ' ',
            key: 'select',
            width: 60,
            align: 'center',
            slot: 'action',
            renderHeader: (h, index) => {
              return h('div', [
                h('Checkbox', {
                  props: {
                    indeterminate: this.haveSevers,
                    value: this.checkAllSevers,
                    disabled: (this.allServerList.length == 0)
                  },
                  nativeOn: {
                    'click': e => {
                      e.preventDefault();
                      this.selectAllSevers();
                    }
                  }
                })
              ])
            }
          });
        }
        ser_columns.push({
          title: '姓名',
          key: 'peopleName'
        });
        ser_columns.push({
          title: '4A主账号',
          key: 'fourA'
        });
        ser_columns.push({
          title: '使用期限',
          key: 'date'
        });
        ser_columns.push({
          title: '账号属性',
          key: 'accountAttr'
        });
        ser_columns.push({
          title: '设备名称',
          key: 'sname'
        });
        ser_columns.push({
          title: '设备IP地址',
          key: 'ip'
        });
        ser_columns.push({
          title: '组读和执行权限目录',
          key: 'rxPath'
        });
        ser_columns.push({
          title: '该用户组需写权限目录',
          key: 'wpath',
        });
        //console.log("---",this.isCancel);
        if (!this.ifedit && this.page != 'accountManager') {
          ser_columns.push({
            title: '操作',
            slot: 'toSonAccount',
            width: 110,
            align: 'center'
          });
        }

        if (this.ifHandle) {
          ser_columns.push({
            title: '是否已分配子流程处理',
            slot: 'ifHandle',
            width: 110,
            align: 'center'
          });
        }
        return ser_columns;
      },
      dbs_columns() {
        let dbs_columns = [];
        if (!this.ifedit && this.page != 'accountManager') {
          dbs_columns.push({
            title: ' ',
            key: 'select',
            width: 60,
            align: 'center',
            slot: 'action',
            renderHeader: (h, index) => {
              return h('div', [
                h('Checkbox', {
                  props: {
                    indeterminate: this.haveDBs,
                    value: this.checkAllDBs,
                    disabled: (this.allDbsList.length == 0)
                  },
                  nativeOn: {
                    'click': e => {
                      e.preventDefault();
                      this.selectAllDBs();
                    }
                  }
                })
              ])
            }
          });
        }
        dbs_columns.push({
          title: '姓名',
          key: 'peopleName'
        });
        dbs_columns.push({
          title: '4A主账号',
          key: 'fourA'
        });
        dbs_columns.push({
          title: '使用期限',
          key: 'date'
        });
        dbs_columns.push({
          title: '账号属性',
          key: 'accountAttr'
        });
        dbs_columns.push({
          title: '设备名称',
          key: 'sname'
        });
        dbs_columns.push({
          title: '设备IP地址',
          key: 'ip'
        });
        dbs_columns.push({
          title: '库名',
          key: 'dbName'
        });
        dbs_columns.push({
          title: '表名',
          key: 'tableName'
        });
        dbs_columns.push({
          title: '权限',
          key: 'auth'
        });
        if (!this.ifedit && this.page != 'accountManager') {
          dbs_columns.push({
            title: '操作',
            slot: 'toSonAccount',
            width: 130,
            align: 'center'
          });
        }
        if (this.ifHandle) {
          dbs_columns.push({
            title: '是否已分配子流程处理',
            slot: 'ifHandle',
            width: 110,
            align: 'center'
          });
        }
        return dbs_columns;
      },
      hadoop_columns() {
        let hadoop_columns = [];
        if (!this.ifedit && this.page != 'accountManager') {
          hadoop_columns.push({
            title: ' ',
            key: 'select',
            width: 60,
            align: 'center',
            slot: 'action',
            renderHeader: (h, index) => {
              return h('div', [
                h('Checkbox', {
                  props: {
                    indeterminate: this.haveHadoops,
                    value: this.checkAllHadoops,
                    disabled: (this.allHadoopList.length == 0)
                  },
                  nativeOn: {
                    'click': e => {
                      e.preventDefault();
                      this.selectAllHadoops();
                    }
                  }
                })
              ])
            }
          });
        }
        hadoop_columns.push({
          title: '姓名',
          key: 'peopleName'
        });
        hadoop_columns.push({
          title: '4A主账号',
          key: 'fourA'
        });
        hadoop_columns.push({
          title: '使用期限',
          key: 'date'
        });
        hadoop_columns.push({
          title: 'keytab描述',
          key: 'keytab'
        });
        hadoop_columns.push({
          title: 'Hadoop组件',
          key: 'hadoopAccountType'
        });
        hadoop_columns.push({
          title: '具体权限描述',
          key: 'auth'
        });
        if (!this.ifedit && this.page != 'accountManager') {
          hadoop_columns.push({
            title: '操作',
            slot: 'toSonAccount',
            width: 130,
            align: 'center'
          });
        }
        if (this.ifHandle) {
          hadoop_columns.push({
            title: '是否已分配子流程处理',
            slot: 'ifHandle',
            width: 110,
            align: 'center'
          });
        }
        return hadoop_columns;
      },
      uap_columns() {
        let uap_columns = [];
        if (!this.ifedit && this.page != 'accountManager') {
          uap_columns.push({
            title: ' ',
            key: 'select',
            width: 60,
            align: 'center',
            slot: 'action',
            renderHeader: (h, index) => {
              return h('div', [
                h('Checkbox', {
                  props: {
                    indeterminate: this.haveUaps,
                    value: this.checkAllUaps,
                    disabled: (this.allUapList.length == 0)
                  },
                  nativeOn: {
                    'click': e => {
                      e.preventDefault();
                      this.selectAllUaps();
                    }
                  }
                })
              ])
            }
          });
        }
        uap_columns.push({
          title: '姓名',
          key: 'peopleName'
        });
        uap_columns.push({
          title: '4A主账号',
          key: 'fourA'
        });
        uap_columns.push({
          title: '使用期限',
          key: 'date'
        });
        uap_columns.push({
          title: '场景说明',
          slot: 'des'
        });
        if (!this.ifedit && this.page != 'accountManager') {
          uap_columns.push({
            title: '操作',
            slot: 'toSonAccount',
            width: 130,
            align: 'center'
          });
        }
        if (this.ifHandle) {
          uap_columns.push({
            title: '是否已分配子流程处理',
            slot: 'ifHandle',
            width: 110,
            align: 'center'
          });
        }
        return uap_columns;
      },
      paas_columns() {
        let paas_columns = [];
        if (!this.ifedit && this.page != 'accountManager') {
          paas_columns.push({
            title: ' ',
            key: 'select',
            width: 60,
            align: 'center',
            slot: 'action',
            renderHeader: (h, index) => {
              return h('div', [
                h('Checkbox', {
                  props: {
                    indeterminate: this.havePaas,
                    value: this.checkAllPaas,
                    disabled: (this.allPaasList.length == 0)
                  },
                  nativeOn: {
                    'click': e => {
                      e.preventDefault();
                      this.selectAllPaas();
                    }
                  }
                })
              ])
            }
          });
        }
        paas_columns.push({
          title: '姓名',
          key: 'peopleName'
        });
        paas_columns.push({
          title: '4A主账号',
          key: 'fourA'
        });
        paas_columns.push({
          title: '使用期限',
          key: 'date'
        });
        paas_columns.push({
          title: '账号类型',
          slot: 'paasType'
        });
        if (!this.ifedit && this.page != 'accountManager') {
          paas_columns.push({
            title: '操作',
            slot: 'toSonAccount',
            width: 130,
            align: 'center'
          });
        }
        if (this.ifHandle) {
          paas_columns.push({
            title: '是否已分配子流程处理',
            slot: 'ifHandle',
            width: 110,
            align: 'center'
          });
        }
        return paas_columns;
      },
      dacp_columns() {
        let dacp_columns = [];
        if (!this.ifedit && this.page != 'accountManager') {
          dacp_columns.push({
            title: ' ',
            key: 'select',
            width: 60,
            align: 'center',
            slot: 'action',
            renderHeader: (h, index) => {
              return h('div', [
                h('Checkbox', {
                  props: {
                    indeterminate: this.haveDacps,
                    value: this.checkAllDacps,
                    disabled: (this.allDacpList.length == 0)
                  },
                  nativeOn: {
                    'click': e => {
                      e.preventDefault();
                      this.selectAllDacps();
                    }
                  }
                })
              ])
            }
          });
        }
        dacp_columns.push({
          title: '姓名',
          key: 'peopleName'
        });
        dacp_columns.push({
          title: '4A主账号',
          key: 'fourA'
        });
        dacp_columns.push({
          title: '使用期限',
          key: 'date'
        });
        dacp_columns.push({
          title: '账号类型',
          key: 'dacpAccoutType'
        });
        if (!this.ifedit && this.page != 'accountManager') {
          dacp_columns.push({
            title: '操作',
            slot: 'toSonAccount',
            width: 130,
            align: 'center'
          });
        }
        if (this.ifHandle) {
          dacp_columns.push({
            title: '是否已分配子流程处理',
            slot: 'ifHandle',
            width: 110,
            align: 'center'
          });
        }
        return dacp_columns;
      },
      else_columns() {
        let else_columns = [];
        if (!this.ifedit && this.page != 'accountManager') {
          else_columns.push({
            title: ' ',
            key: 'select',
            width: 60,
            align: 'center',
            slot: 'action',
            renderHeader: (h, index) => {
              return h('div', [
                h('Checkbox', {
                  props: {
                    indeterminate: this.haveElse,
                    value: this.checkAllElse,
                    disabled: (this.allElseList.length == 0)
                  },
                  nativeOn: {
                    'click': e => {
                      e.preventDefault();
                      this.selectAllElse();
                    }
                  }
                })
              ])
            }
          });
        }
        else_columns.push({
          title: '姓名',
          key: 'peopleName'
        });
        else_columns.push({
          title: '4A主账号',
          key: 'fourA'
        });
        else_columns.push({
          title: '使用期限',
          key: 'date'
        });
        else_columns.push({
          title: '说明',
          key: 'des'
        });
        if (!this.ifedit && this.page != 'accountManager') {
          else_columns.push({
            title: '操作',
            slot: 'toSonAccount',
            width: 130,
            align: 'center'
          });
        }
        if (this.ifHandle) {
          else_columns.push({
            title: '是否已分配子流程处理',
            slot: 'ifHandle',
            width: 110,
            align: 'center'
          });
        }
        return else_columns;
      }
    },
    props: {
      params: {},
      myAccount: {},
      page: {},
      ifedit: {},
      serviceType: {},
      taskDefKey: {},
      ifCancelAccount: {
        default: false
      },
      isEdit: {}
    },
    watch: {
      ifCancelAccount(val) {
        //this.ifCancelAccount = val;
        this.isCancel = val;
        //console.log("-isCancel-----",this.isCancel);
      },
      myAccount(val) {
        console.log("--------从账号组件---------", this.myAccount, val);
        if (this.page === "accountManager") {
          console.log("--------wwwwwaccountManager---------");
          this.myAccount = val;
          this.getNoHandleAccountt(this.myAccount);
        } else {
          this.myAccount = val;
          this.getNoHandleAccountt(this.myAccount);
          this.peopleMap = val.peopleMap;
        }

      },
      page(val) {
        this.page = val;
        //console.log("--------page从账号组件========---------",this.page,val);
      },
      ifedit(val) {
        this.ifedit = val;
      },
      taskDefKey(val) {
        //console.log("88888888",val);
        this.taskDefKey = val;
      }
    }
  }
</script>
